<html>
<head><meta charset="utf-8"><title>being able to tell why a goal is not met · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/being.20able.20to.20tell.20why.20a.20goal.20is.20not.20met.html">being able to tell why a goal is not met</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="197716866"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/being%20able%20to%20tell%20why%20a%20goal%20is%20not%20met/near/197716866" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/being.20able.20to.20tell.20why.20a.20goal.20is.20not.20met.html#197716866">(May 15 2020 at 16:28)</a>:</h4>
<p>So while debugging why a certain trait goal doesn't yet work in rust-analyzer, I thought it'd be nice if we could easily know which subgoal actually failed (sure, I can look at the log, but...). And actually, it seems rustc is able to do this at least sometimes for diagnostic purposes, e.g. in <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=34c71ae9ca579c8df22ee495b465a6cc">this case</a>. So something like this should be in scope for Chalk as well, right?</p>



<a name="197735751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/being%20able%20to%20tell%20why%20a%20goal%20is%20not%20met/near/197735751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/being.20able.20to.20tell.20why.20a.20goal.20is.20not.20met.html#197735751">(May 15 2020 at 18:49)</a>:</h4>
<p>Yeah, this is definitely something I've thought about</p>



<a name="197735771"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/being%20able%20to%20tell%20why%20a%20goal%20is%20not%20met/near/197735771" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/being.20able.20to.20tell.20why.20a.20goal.20is.20not.20met.html#197735771">(May 15 2020 at 18:49)</a>:</h4>
<p>I'm curious how much easier this would be to try to implement with tracing</p>



<a name="197754728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/being%20able%20to%20tell%20why%20a%20goal%20is%20not%20met/near/197754728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/being.20able.20to.20tell.20why.20a.20goal.20is.20not.20met.html#197754728">(May 15 2020 at 21:29)</a>:</h4>
<p>well so</p>



<a name="197754782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/being%20able%20to%20tell%20why%20a%20goal%20is%20not%20met/near/197754782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/being.20able.20to.20tell.20why.20a.20goal.20is.20not.20met.html#197754782">(May 15 2020 at 21:29)</a>:</h4>
<p>I think this is probably somewhat more straightforward in the recursive solver</p>



<a name="197754796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/being%20able%20to%20tell%20why%20a%20goal%20is%20not%20met/near/197754796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/being.20able.20to.20tell.20why.20a.20goal.20is.20not.20met.html#197754796">(May 15 2020 at 21:29)</a>:</h4>
<p>I guess it depends whether you're talking about "for debugging" or "for error reporting"</p>



<a name="197754802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/being%20able%20to%20tell%20why%20a%20goal%20is%20not%20met/near/197754802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/being.20able.20to.20tell.20why.20a.20goal.20is.20not.20met.html#197754802">(May 15 2020 at 21:29)</a>:</h4>
<p>I think the latter is more interesting :)</p>



<a name="197783040"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/being%20able%20to%20tell%20why%20a%20goal%20is%20not%20met/near/197783040" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/being.20able.20to.20tell.20why.20a.20goal.20is.20not.20met.html#197783040">(May 16 2020 at 07:59)</a>:</h4>
<p>well, I came from the debugging, but I thought if we need the error reporting interface anyway, that might serve the debugging usecase as well</p>



<a name="200019811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/being%20able%20to%20tell%20why%20a%20goal%20is%20not%20met/near/200019811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tim <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/being.20able.20to.20tell.20why.20a.20goal.20is.20not.20met.html#200019811">(Jun 07 2020 at 11:18)</a>:</h4>
<p>Hi all! Indeed if the solver returns <code>None</code>, I'm not sure how to produce a meaningful diagnostic to show to the user. Is there any way with the current Chalk version to get some more information? Even a small bit of information is potentially very useful. For example, suppose we have:</p>
<div class="codehilite"><pre><span></span><code>trait Foobar { }
struct Binary&lt;T1: Foobar, T2: Foobar&gt; { }

struct Left { }
struct Right { }

impl Foobar for Left { }

WellFormed(Binary&lt;Left, Right&gt;);
</code></pre></div>


<p>In this case it would already be much more helpful if a compiler using Chalk could establish that <code>Binary&lt;Left, [[Right]]&gt;</code> is causing the failure instead of rejecting the type entirely. This still wouldn't be nearly as useful as Rustc's current error messages, but it would definitely be an improvement.</p>



<a name="200160492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/being%20able%20to%20tell%20why%20a%20goal%20is%20not%20met/near/200160492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/being.20able.20to.20tell.20why.20a.20goal.20is.20not.20met.html#200160492">(Jun 08 2020 at 21:51)</a>:</h4>
<p>Yeah right now we don't give much for useful feedback</p>



<a name="200160495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/being%20able%20to%20tell%20why%20a%20goal%20is%20not%20met/near/200160495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/being.20able.20to.20tell.20why.20a.20goal.20is.20not.20met.html#200160495">(Jun 08 2020 at 21:51)</a>:</h4>
<p>I'm not sure the best way to do that</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>